Possible Integer Overflow Before Conversion to Long (PIOBCL)

Description:

PIOBCL detects situations where an integer overflow may occur as a result of an arithmetic expression evaluation. Integer overflows may occur with addition, subtraction, multiplication, or in shift left operations with integer operands converted to int64. Since an operation is performed with integer operands, an overflow can happen before conversion.

An overflow can be avoided by converting one of the operation operands to a int64, so the operation will be performed with int64 operands.

This message is produced not only for explicit type conversions done by the programmer, but also for implicit type conversions performed by compiler.

Incorrect:

function multiply(a,b:integer):int64;
begin
   result :=a * b;
end;

Correct:

function multiply(a,b:integer):int64;
begin
   result :=int64(a) * b;
end;